import { DEFAULT_LAYOUT } from '../base';
import { type AppRouteRecordRaw } from '../types';
import { IconBook } from "@arco-design/web-vue/es/icon";
import type { RouteLocation } from 'vue-router';
import i18n from '@/settings/i18n';

const routes: AppRouteRecordRaw = {
  path: '/operator',
  redirect: '/operator/toolbar',
  component: DEFAULT_LAYOUT,
  meta: {
    title: i18n.global.t('settings.menu.operator.title'),
    icon: IconBook,
    order: 200,
    roles: ['editor'],
  },
  children: [
    {
      path: 'toolbar/index',
      component: () => import('@/settings/views/toolbar/index.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.toolbar.index'),
      },
    },

    {
      path: 'banner/index',
      component: () => import('@/settings/views/operation/index.vue'),
      props: () => ({ pageType: 'banner' }),
      meta: {
        title: i18n.global.t('settings.menu.operator.banner.index'),
      },
    },
    {
      path: 'banner/add',
      component: () => import('@/settings/views/operation/add-edit.vue'),
      props: () => ({ pageType: 'banner' }),
      meta: {
        title: i18n.global.t('settings.menu.operator.banner.add'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/banner/index',
      },
    },
    {
      path: 'banner/edit/:id',
      component: () => import('@/settings/views/operation/add-edit.vue'),
      props: (route: RouteLocation) => ({ id: route.params.id, pageType: 'banner' }),
      meta: {
        title: i18n.global.t('settings.menu.operator.banner.edit'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/banner/index',
      },
    },

    {
      path: 'operation/index',
      component: () => import('@/settings/views/operation/index.vue'),
      props: () => ({ pageType: 'operation' }),
      meta: {
        title: i18n.global.t('settings.menu.operator.operator.index'),
      },
    },
    {
      path: 'operation/add',
      component: () => import('@/settings/views/operation/add-edit.vue'),
      props: () => ({ pageType: 'operation' }),
      meta: {
        title: i18n.global.t('settings.menu.operator.operator.add'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/operation/index',
      },
    },
    {
      path: 'operation/edit/:id',
      component: () => import('@/settings/views/operation/add-edit.vue'),
      props: (route: RouteLocation) => ({ id: route.params.id, pageType: 'operation' }),
      meta: {
        title: i18n.global.t('settings.menu.operator.operator.edit'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/operation/index',
      },
    },

    {
      path: 'subscription/user/index',
      component: () => import('@/settings/views/subscription/user/index.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.subscribe.index'),
      },
    },
    {
      path: 'subscription/user/send-history',
      component: () => import('@/settings/views/subscription/user/send-history.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.subscribe.history'),
        hideInMenu: true,
        ignoreCache: true,
        noAffix: true,
        activeMenu: '/operator/subscription/user/index',
      },
    },

    {
      path: 'subscription/template/index',
      component: () => import('@/settings/views/subscription/template/index.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.email.index'),
      },
    },
    {
      path: 'subscription/template/add',
      component: () => import('@/settings/views/subscription/template/add-edit.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.email.add'),
        hideInMenu: true,
        ignoreCache: true,
        noAffix: true,
        activeMenu: '/operator/subscription/template/index',
      },
    },
    {
      path: 'subscription/template/edit/:id',
      component: () => import('@/settings/views/subscription/template/add-edit.vue'),
      props: true,
      meta: {
        title: i18n.global.t('settings.menu.operator.email.edit'),
        hideInMenu: true,
        ignoreCache: true,
        noAffix: true,
        activeMenu: '/operator/subscription/template/index',
      },
    },

    {
      path: 'popup-window/index',
      component: () => import('@/settings/views/popup-window/index.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.popupWindow.index'),
      },
    },

    {
      path: 'event/index',
      component: () => import('@/settings/views/event/index.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.event.index'),
      },
    },
    {
      path: 'event/add',
      component: () => import('@/settings/views/event/add-edit.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.event.add'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/event/index',
      },
    },
    {
      path: 'event/edit/:id',
      component: () => import('@/settings/views/event/add-edit.vue'),
      props: true,
      meta: {
        title: i18n.global.t('settings.menu.operator.event.edit'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/event/index',
      },
    },
    {
      path: 'notice/index',
      component: () => import('@/settings/views/notice/index.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.notice.index'),
      },
    },

    {
      path: 'activity-application/index',
      component: () => import('@/settings/views/activity-application/index.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.activityApplication.index'),
      },
    },
    {
      path: 'activity-application/add',
      component: () => import('@/settings/views/activity-application/add-edit.vue'),
      meta: {
        title: i18n.global.t('settings.menu.operator.activityApplication.add'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/activity-application/index',
      },
    },
    {
      path: 'activity-application/edit/:id',
      component: () => import('@/settings/views/activity-application/add-edit.vue'),
      props: true,
      meta: {
        title: i18n.global.t('settings.menu.operator.activityApplication.edit'),
        hideInMenu: true,
        ignoreCache: true,
        activeMenu: '/operator/activity-application/index',
      },
    },
  ],
};

export default routes;
